package com.wanczy.dao.proxy;

import java.sql.Connection;
import java.util.List;

import org.apache.commons.dbutils.DbUtils;

import com.wanczy.dao.MenuTableDAO;
import com.wanczy.dao.impl.MenuTableDAOImpl;
import com.wanczy.pojo.MenuTable;
import com.wanczy.util.GetDBConnection;

public class MenuTableDAOProxy implements MenuTableDAO {
	public Connection conn;
	public MenuTableDAOImpl impl = null;
	public MenuTableDAOProxy() {
		try {
			this.conn = GetDBConnection.getConnection();// 取得数据库连接
			this.impl = new MenuTableDAOImpl(this.conn);
		} catch (Exception e) {
			e.printStackTrace();
		}
	} 
	@Override
	public List<MenuTable> findMenu() {
		List<MenuTable> list = this.impl.findMenu();
		DbUtils.closeQuietly(conn);
		return list;
	}
	@Override
	public List<MenuTable> findDownMenu(String menuLevel,int userId) {
		List<MenuTable> list = this.impl.findDownMenu(menuLevel,userId);
		DbUtils.closeQuietly(conn);
		return list;
	}

}
